# -*- coding: utf-8 -*-
# @Time : 2021/12/23 10:28
# @Author : Limusen
# @File : config_utils

import os
import configparser

current_path = os.path.dirname(os.path.abspath(__file__))
config_path = os.path.join(current_path, '..', 'conf', 'conf.ini')



class ConfigUtils:

    def __init__(self, cfg_path=config_path):
        self.cfg = configparser.ConfigParser()
        self.cfg.read(cfg_path, encoding="utf-8")

    @property  # 将类方法变成类属性 方便调用
    def get_hosts(self):
        hosts = self.cfg.get("default", "hosts")
        return hosts

    @property
    def OPERATION_PLATFORM_HOST(self):
        """
        运营后台网址
        :return:
        """
        host = self.cfg.get("default", "operation-platform_host")
        return host

    @property
    def USER_PLATFORM_HOST(self):
        """
        用户后台网址
        :return:
        """
        host = self.cfg.get("default", "operation-platform_host")
        return host

    @property
    def APPS_HOST(self):
        """
        App网址
        :return:
        """
        app_host = self.cfg.get("default", "app_host")
        return app_host

    @property
    def LOG_PATH(self):
        log_path = self.cfg.get("path", "log_path")  # 获取值
        return log_path

    @property
    def LOG_NAME(self):
        log_name = self.cfg.get("default", "log_name")  # 获取值
        return log_name

    @property
    def CASE_PATH(self):
        case_path = self.cfg.get("path", "case_path")  # 获取值
        return case_path

    @property
    def REPORT_PATH(self):
        report_path = self.cfg.get("path", "report_path")  # 获取值
        return report_path


local_config = ConfigUtils()

if __name__ == '__main__':
    print(local_config.APPS_HOST)
